package foliotracker;

import java.io.Serializable;
import java.util.Date;
import java.util.Observable;

/**
 * Represents a transaction where a quantity of stock is bought at a certain price.
 */
public class StockTransaction extends Observable implements Serializable
{
	private static final long serialVersionUID = 1L;
	private Date date;
	private int quantity;
	private double price;
	
	/**
	 * Constructor.
	 * @param date The date the stock was bought on.
	 * @param quantity The quantity of stock bought.
	 * @param price The price the stock was bought at.
	 */
	public StockTransaction(Date date, int quantity, double price)
	{
		this.date = date;
		this.quantity = quantity;
		this.price = price;
	}
	
	/**
	 * Gets the date the stock was bought on.
	 * @return
	 */
	public Date getDate()
	{
		return date;
	}
	
	/**
	 * Gets the quantity of stock bought.
	 * @return
	 */
	public int getQuantity()
	{
		return quantity;
	}
	
	/**
	 * Gets the price the stock was bought at.
	 * @return
	 */
	public double getPrice()
	{
		return price;
	}
	
	public void setQuantity(int value)
	{
		quantity = value;
		this.setChanged();
		this.notifyObservers();
	}
}
